export const schema = {
    type: "page",
    title: "待审核项目",
    toolbar: {
        type: "button",
        actionType: "link",
        icon: "fa fa-plus pull-left",
        level: "success",
        label: "新建项目",
        visibleOn: 'acl.can("project:create")',
        link: "/project/create"
    },
    body: [
        {
            type: "nav",
            stacked: false,
            links: [

                {
                    label: "进行中",
                    to: "/project/my/processing"
                },
                {
                    label: "待审核",
                    active: true,
                    to: "/project/my/pending",
                    visibleOn: 'acl.can("project:pending")'
                },

                {
                    label: "待提交",
                    to: "/project/my/draft"
                },

                {
                    label: "已结项",
                    to: "/project/my/outdated"
                }
            ]
        },
        {
            type: "wrapper",
            className: "b-l b-b b-r bg-white no-padder",
            body: {
                type: "crud",
                api: "/api/project/pending",
                panelClassName: "no-border no-shadow bg-white",
                showHeader: false,
                columns: [
                    {
                        name: "name",
                        label: "项目名称",
                        type: "tpl",
                        tpl: "<a data-link='/project/view/${id}'>${name}</a>"
                    },
                    {
                        label: "发起日期",
                        name: "created_at",
                        type: "tpl",
                        tpl: "${created_at|date:LL:YYYY-MM-DD HH:mm:ss}"
                    },
                    {
                        label: "状态",
                        name: "verify_status",
                        type: "map",
                        map: {
                            "-1": "<span class='label label-info'>编辑中</span>",
                            "0": "<span class='label label-warning'>待审核</span>",
                            "1": "<span class='label label-success'>已通过</span>",
                            "2": "<span class='label label-default'>已拒绝</span> ${verify_msg}",
                            "*": "${verify_status}"
                        }
                    },

                    {
                        label: "操作",
                        type: "operation",
                        width: 180,
                        buttons: [
                            {
                                type: "button",
                                size: "xs",
                                label: "查看",
                                actionType: "dialog",
                                dialog: {
                                    disabled: true,
                                    title: "手机扫一扫查看页面",
                                    size: 'sm',
                                    body: `
                                        <div class="text-center">
                                            <img src="/qrcode?size=250&data=<%= encodeURIComponent(data.preview_url) %>" />
                                        </div>
                                    `
                                }
                            },
                            {
                                type: "button",
                                size: "xs",
                                level: "primary",
                                label: "编辑",
                                actionType: "link",
                                visibleOn: 'data.verify_status == -1',
                                link: "/project/edit/${id}"
                            },
                            {
                                type: "button",
                                size: "xs",
                                level: "info",
                                label: "撤销提交",
                                actionType: "ajax",
                                visibleOn: 'data.verify_status == 0',
                                api: '/api/project/cancel/${id}'
                            }
                        ]
                    }
                ]
            }
        }
    ]
};
